package cn.stylefeng.guns.modular.ry600.service.impl;

import java.util.List;
import java.util.Map;

import cn.stylefeng.guns.modular.system.model.Orderitem;
import cn.stylefeng.guns.modular.system.dao.OrderitemMapper;
import cn.stylefeng.guns.modular.ry600.service.IOrderitemService;
import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author stylefeng
 * @since 2018-12-14
 */
@Service
public class OrderitemServiceImpl extends ServiceImpl<OrderitemMapper, Orderitem> implements IOrderitemService {
	@Autowired
	private OrderitemMapper orderitemMapper;
	@Override
	public Object selectByMsg(Map<String, Object> msg) {
		if (MapUtils.isNotEmpty(msg)) {
			String[] likeFields = { "orgName"};
			for (String field : likeFields) {
				if (msg.containsKey(field)) {
					msg.put(field, "%" + (String) msg.get(field) + "%");
				}
			}
		}
		
		return orderitemMapper.selectByMsg(msg);
	}
	@Override
	@DataSource(name = "#dataSource")
	public int insertOrderitems(List<Orderitem> oil,String dataSource) {
		return orderitemMapper.insertOrderitems(oil);
	}
	
	
	@Override
	@DataSource(name = "#dataSource")
	public int insertOrderitem(Orderitem oil,String dataSource) {
		return orderitemMapper.insertOrderitem(oil);
	}
}
